feat: consume v2 estimated aprs from kong#561
Merged
matheus1lva merged 4 commits intomainfrom Feb 2, 2026
Merged
Conversation
…rome vaults Replace local RPC-based forward APR calculations with pre-computed estimated APRs from Kong's GraphQL API for V2 vaults. This integration reduces RPC call volume and improves performance while maintaining full backward compatibility. Changes: - Add TKongEstimatedApr and TKongEstimatedAprComponents types to Kong client and models - Update Kong GraphQL queries to fetch performance.estimated field with all components - Extract and store estimated APR data in Kong indexer - Add GetKongEstimatedAPY() storage accessor function - Modify forward APY calculation to prioritize Kong data with graceful fallback to local computation - Update apr-oracle-integration.md with V2 estimated APR integration documentation Supported chains: Ethereum (1), Optimism (10), Fantom (250), Arbitrum (42161), Base (8453) Supported strategies: Curve, Convex, Velodrome, Aerodrome Implements: #560
murderteeth
requested changes
Jan 27, 2026
Collaborator
murderteeth
left a comment
There was a problem hiding this comment.
- build and run ydaemon in dev
- configure main branch yearn.fi to point at local ydaemon
- compare est apy's from v2 vault list in yearn.fi local dev with yearn.fi live
- some look good, but i also see differences that can't be explained by timing differences. implementing yearn/v2-estimated-apr-hook#5 may fix some of these
Collaborator
Author
Yeah that's fair, could be the case. |
Collaborator
Author
murderteeth
requested changes
Jan 31, 2026
Collaborator
this looks like a problem in the v2 estimated apr service to me @matheus1lva. i see a zero apr for ycrv here too |
Collaborator
Author
murderteeth
approved these changes
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary
This PR integrates Kong's pre-computed estimated APRs into yDaemon for V2 vaults with Curve, Convex, Velodrome, and Aerodrome strategies. The implementation prioritizes Kong's estimated APR data over local RPC-based calculations, reducing RPC call volume and improving performance while maintaining full backward compatibility with the existing API.
Closes #560
How to review
internal/models/vaults.goandinternal/kong/client.goto review the newTKongEstimatedAprandTKongEstimatedAprComponentstypesinternal/kong/client.gofor the expanded performance.estimated queryinternal/indexer/indexer.kong.goto see how estimated APR data is extracted from Kong responsesinternal/storage/elem.vaults.gofor the newGetKongEstimatedAPY()functionprocesses/apr/main.goto see the Kong-first fallback pattern for Curve and Velo vaultsprocesses/apr/forward.curve.helpers.goforconvertKongEstimatedAprToForwardAPY()docs/apr-oracle-integration.mdfor the new V2 integration sectionTest plan
Manual testing
Verified integration with live yDaemon instance:
Query vault on Ethereum mainnet (Curve vault):
Result:
{ "address": "0xf165a634296800812B8B0607a75DeDdcD4D3cC88", "name": "reUSD/scrvUSD", "type": "crv", "netAPR": 0.04918341021632009, "composite": { "boost": 2.2711417165483674, "poolAPY": 0.008, "boostedAPR": 0.04620378912924455, "baseAPR": 0.03806021027585871, "cvxAPR": 0, "rewardsAPR": 0 } }Verify Kong source data:
Kong response (matches yDaemon output exactly):
{ "apr": 0.04918341021632009, "apy": 0.04918341021632009, "type": "crv", "components": { "boost": 2.2711417165483674, "poolAPY": 0.008, "boostedAPR": 0.04620378912924455, "baseAPR": 0.03806021027585871, "rewardsAPY": 0, "cvxAPR": 0, "keepCRV": 0 } }✅ Verification: yDaemon successfully consumes Kong's estimated APR data. All values match exactly, confirming the integration works as expected.